package com.myway.components.process;

import com.myway.components.client.GzipClient;
import org.apache.log4j.Logger;

import com.myway.dto.base.ReturnMessage;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;

public class ProcessUtil {
	private Logger log=Logger.getLogger(ProcessUtil.class);
	
	/**
	 * @名称：startProcess 
	 * @描述：启动工作流 
	 * @param param
	 * @return
	*/
	public static ReturnMessage startProcess(ProcessModel param)  {
		ReturnMessage retMsg=null;
		try {
			Gson gson=new GsonBuilder().setDateFormat("yyyy-MM-dd HH:mm:ss").create();
			retMsg = GzipClient.post("startCommonProcess", gson.toJson(param));
			if("".equals(retMsg.getReturnCode())){
				retMsg.setReturnCode("0000");
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
		return retMsg;
	}
	public static void main(String[] args) {
		try {
			ProcessModel p=new ProcessModel();
			p.setWorkFlowKey("refundOrder");
			p.setBusinessKey("717831");
			p.setAppId("B2C");
			p.setApplyUserId("admin");
			p.setAppName("host_104");
			p.setPath("backend/order/refundOrderDetail!refundOrderDetail.action?id="+p.getBusinessKey());
			p.setCustomeTitle("退票工作流");
			ReturnMessage rm=ProcessUtil.startProcess(p);
			System.out.println(new Gson().toJson(rm));
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
}
